How to use the ComServer with LabView:

Important: Before beginning, copy the file com6srvr.tlb from your Motion Planner 
CD to your LabView directory!


Two examples are included on your Motion Planner CD-ROM illustrating the use of the 
ComServer with LabViews built-in ActiveX virtual instruments. They incorporate the
Compumotor 6K, communicating over RS232 and Ethernet, and show basic operations 
like updating motor position and sending/receiving commands. 

These examples were written in National Instruments LabView 5.1 and will not open 
under an earlier version! The ComServer has been tested as far back as LabView 4.1; the 
VIs are slightly different but the general methodology is the same. Consult your 
LabView user guides for information regarding the ActiveX/Automation VIs in versions 
earlier than 5.1. 

Compumotors Motion Toolbox software is not compatible with the 6K or the Gemini. 
The ComServer, when used with LabViews ActiveX VIs, provide the full range of 
compatibility and control. 

Common Error:   If, upon opening one of the examples, the RUN button is broken, 
indicating an error with the wiring, make sure the file com6srvr.tlb is in your LabView 
root directory (on most computers, C:/Program Files/National Instruments/LabView/).
This file will not be installed during normal Motion Planner installation and must be 
manually copied from the CD-ROM. If the file is in place and the RUN is still broken, 
delete the ComServer refnum constant on the diagram, go to the AutomationOpen.VI
(the very first one), and follow steps 3-6 below. 

            The examples contained on the Motion Planner CD-ROM are meant to serve as reference 
and learning tool only. It is left to the user to create a front end that is specifically tailored 
to the application. Below is a step-by-step method of how these examples were created, to 
assist you in that process (VI names are specific to LabView 5.1).

1. Right click on your new LabView diagram to open the Functions palette.
2. Go to Communications/ActiveX menu and drag an instance of the Automation Open 
VI onto the diagram.
3. Press the space bar until you have the spool tool, and go to the Automation Refnum 
terminal in the upper left.
4. Right click on this terminal and choose Select ActiveX Class/Browse
5. Select Browse and locate the file com6srvr.tlb in your LabView directory.
6. You will now have three options listed: Gemini, Net, and RS232. Choose Net if you 
want to open an Ethernet connection with the 6K, or RS232 if you want serial 
communications with the 6K. An ActiveX Automation Refnum constant will now be 
wired to the terminal.
 
7. Now drag an instance of the Invoke Node VI onto the diagram. Wire the Automation 
Refnum output of the Automation Open VI (upper right) to the Reference input of the 
Invoke Node VI. This Refnum is a LabView reference to a particular communications 
session and should be wired from output to input of every VI in the chain. 
8. Once the reference is connected, you will see Automation change to either 
IRS232 or INET. Right-click on the method terminal and go to Methods and you 
will see a list of the available 6K ComServer methods. Choose Connect.
9. An additional terminal called commPort (for RS232) or net address (for Ethernet) 
will now appear. Wire the appropriate communications address to this terminal. 
10. Drag additional instances of  Invoke Node VI onto your diagram as needed. LabView 
will automatically show you the available methods when you right-click. For Ethernet 
properties, use the Property Node VI as well. Remember to connect the reference 
output terminal of the previous VI to the reference input terminal of the next VI. For 
help on methods and properties, refer to the 6K Programmers Guide. 
11. Drag an instance of Automation Close VI onto the diagram and connect the terminals. 
This will shut down the 6K ComServer. 


If you have any questions or problems, please call the Compumotor Applications Dept. at
(800) 358-9070, or email to tech_help@cmotor.com . 

040699

